﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DDList.aspx.cs" Inherits="Admin_User_OrderList" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>订单管理</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="../css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="../css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="../css/animate.css" rel="stylesheet">
    <link href="../css/style.css?v=4.1.0" rel="stylesheet">
    <link href="../css/plugins/footable/footable.core.css" rel="stylesheet" />
    <link href="../css/plugins/iCheck/custom.css" rel="stylesheet">

    <link href="../../dis/My97DatePicker/skin/whyGreen/datepicker.css" rel="stylesheet" />
    <link href="../../dis/My97DatePicker/skin/default/datepicker.css" rel="stylesheet" />
    <script src="../../dis/My97DatePicker/WdatePicker.js"></script>

    <style>
        .trorder {
            /*background: #f8f8f8;*/
            border: 1px solid #f2f2f2;
            text-align: left;
        }

        .footable-odd {
            background: #fff;
        }

        .trcenter {
            border: 1px solid #f2f2f2;
        }

            .trcenter td {
                border: 1px solid #f2f2f2;
            }


        .goods {
            padding: 5px;
        }



            .goods dl {
                margin-left: 8px;
                margin-top: 0;
                margin-bottom: 0px;
            }

        .footable-odd {
            background: #fff;
        }

        .trcenter {
            border: 1px solid #f2f2f2;
        }

        .trorder dl {
            margin-bottom: 0px;
        }

        dl {
            margin-bottom: 0px;
        }

        .ewmimage img {
            width: 100%;
            height: 100%;
        }
    </style>


</head>

<body class="gray-bg" style="height: 100%;">
    <form id="form1" runat="server" class="form-horizontal">
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-sm-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">

                            <asp:TextBox ID="txtUtel" runat="server" placeholder="提货人手机号码或姓名" Style="padding: 5px 12px; margin: 5px 0; width: 196px;"></asp:TextBox>
                            &nbsp;&nbsp;  
                    
                         <asp:TextBox ID="txtSHUtel" runat="server" placeholder="收货人手机号码或姓名" Style="padding: 5px 12px; margin: 5px 0; width: 196px;"></asp:TextBox>
                            &nbsp;&nbsp;  
        
                                <asp:TextBox ID="txtStartTime" runat="server" Style="padding: 5px 12px; width: 196px;" onclick="WdatePicker({el:'txtStartTime',startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})" placeholder="点击选择时间"></asp:TextBox>
                            &minus;<asp:TextBox ID="txtEndtime" runat="server" Style="padding: 5px 12px; width: 196px;" onclick="WdatePicker({el:'txtEndtime',dateFmt:'yyyy/MM/dd HH:mm:ss'})" placeholder="点击选择时间"></asp:TextBox>
                            &nbsp;&nbsp;

                            
                                <asp:DropDownList ID="ddlState" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlState_SelectedIndexChanged" Style="padding: 5px 12px; margin: 5px 0; width: 196px;">
                                    <asp:ListItem Value="请选择">订单状态</asp:ListItem>
                                    <asp:ListItem Value="-3">作废</asp:ListItem>
                                    <asp:ListItem Value="-2">用户取消</asp:ListItem>
                                    <asp:ListItem Value="1">待发货</asp:ListItem>
                                    <asp:ListItem Value="2">已发货</asp:ListItem>
                                </asp:DropDownList>


                            <asp:DropDownList ID="ddlPayState" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlState_SelectedIndexChanged" Style="padding: 5px 12px; margin: 5px 0; width: 196px;">
                                <asp:ListItem Value="请选择">支付状态</asp:ListItem>
                                <asp:ListItem Value="0">未支付</asp:ListItem>
                                <asp:ListItem Value="1"  Selected="True">已支付</asp:ListItem>
                            </asp:DropDownList>



                            <asp:TextBox ID="txtOrder" runat="server" placeholder="请输入订单号" Style="padding: 5px 12px; margin: 5px 0; width: 196px;"></asp:TextBox>
                            &nbsp;&nbsp;<asp:Button ID="btnSearch" runat="server" Text="查询" OnClick="btnSearch_Click" CssClass='btn btn-primary btn-sm' />



                            <div class="" style="color: #11bf79; padding: 5px 0 0 8px;">
                                <%-- <h4>共查询到订单：<%=totalNumber %>条</h4>--%>
                            </div>





                            <a href="DDList.aspx" class="btn btn-primary btn-xs"><i class="fa fa-refresh">&nbsp;&nbsp; 刷 新</i></a>

                            <%--<a href="#" id="Add" class="btn btn-primary btn-xs"><i class="fa fa-plus"></i>&nbsp;&nbsp; 新增</a>--%>
                        </div>
                        <div class="ibox-content">

                            <asp:Repeater ID="rptList" runat="server" OnItemCommand="rptList_ItemCommand" OnItemDataBound="rptList_ItemDataBound">
                                <HeaderTemplate>

                                    <table class="footable table table-striped  toggle-arrow-tiny table-hover" data-page-size="80">

                                        <thead>
                                            <tr>
                                                <th align="center">编号</th>
                                                <th align="center" width="200px">商品名称</th>
                                                   <th align="center">物流信息</th>
                                                <th align="center">总价(邮费)</th>
                                     
                                                <th align="center">购买人</th>
                                                <th align="center">直接推荐人</th>
                                                <th align="center">间接推荐人</th>
                                                <th align="center">支付状态</th>
                                                <th align="center" style="color: #11bf79">支付时间</dl>
                                                   
                                                     <dl style="color: #ff0000">下单时间</dl>
                                                </th>

                                                <th align="center">操作 </th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <tr class="trcenter">
                                        <asp:Label ID="od_id" runat="server" Text='<%#Eval("OrderID")%>' Visible="False"></asp:Label>

                                        <td>
                                            <asp:CheckBox ID="cb_id" CssClass="checkbox i-checks" runat="server" Text='<%#Eval("OrderID")%>' />
                                            <span style="color: darkgreen"><%#Convert.ToString(Eval("OendTime"))%><span>
                                        </td>
                                        <td class="trorder goods" style="max-width: 620px">
                                            <asp:Repeater ID="Repeater11" runat="server">
                                                <ItemTemplate>
                                                    <span style="width: 230px; display: block; float: left; padding: 2px;">

                                                        <img src="<%#Eval("SPImgUrl")%>" style="float: left; width: 50px; height: 50px; border: 1px solid #ccc; padding: 1px;">

                                                        <span class="goods" style="float: left">
                                                            <dl>[<%# Container.ItemIndex + 1%>]<%#Eval("SPName")%></dl>
                                                            <dl style="color: red">× <%#Eval("ONumber")%></dl>
                                                        </span>

                                                    </span>
                                                </ItemTemplate>
                                            </asp:Repeater>
                                        </td>

                                        
                                        <td class="trorder">
                                            <%#Convert.ToString(Eval("OPeople"))%>
                                            <%#Convert.ToString(Eval("OProvance"))%>
                                            <%#Convert.ToString(Eval("OCity"))%>
                                            <%#Convert.ToString(Eval("ODistrict"))%>

                                            <dl><%#Convert.ToString(Eval("OAddress"))%></dl>
                                            <dl><%#Convert.ToString(Eval("OTel"))%></dl>
                                            </span>

                                        </td>

                                        <td class="trorder"><%#Eval("OFinalPrice")%>（<%#Eval("OpostPrice")%> ） </td>


                                       
                                        <td class="trorder"><%#_rky.getUnamebyOPID(Convert.ToString(Eval("UGUID")))%></a></td>


                                        <td class="trorder"><%#_rky.getUnamebyOPID(Convert.ToString(Eval("ParentOopenID")))%></a></td>

                                        
                                        <td class="trorder"><%#_rky.getUnamebyOPID(Convert.ToString(Eval("ParentParentOopenID")))%></a></td>


                                        <td class="trorder"><a onclick="viewOrder('<%#Convert.ToString(Eval("OrderID"))%>')"><%#getPayState(Convert.ToString(Eval("OPayState")))%></a></td>

                                        <td class="trorder" style="color: #11bf79">
                             
                                             <%#Convert.ToString(Eval("transaction_id"))%>
                                            <br>
                                          支付: <%#Convert.ToString(Eval("OpayTime"))%>
                                                 <br>
                                            <dl style="color: #ff0000"> 下单：<%#Convert.ToString(Eval("OCreatTime"))%></dl>

                                        </td>


                                        <td class="trorder">
                                            <a onclick="SendGood('<%#Convert.ToString(Eval("OrderID"))%>')">
                                             
                                               <b  style="color:red">¥<%#Eval("OFinalPrice")%></b>
                                                
                                                <%#getFahuoState(Eval("OState").ToString())%>
                                            </a>

                                            <a class="btn btn-success btn-xs" onclick="SendGood('<%#Convert.ToString(Eval("OrderID"))%>')">订单详细
                                            </a>

                                        </td>

                                        <%--<td>购买数量:<%#Eval("ONumber") %></td>--%>
                                        <!--<td>
                                            <a onclick="LookUseDetail('Convert.ToString(Eval("UGUID"))')" class="btn btn-info btn-xs"><i class="fa fa-pencil"></i>&nbsp;&nbsp;  使用情况</a>
                                            <asp:LinkButton ID="LinkButton1" runat="server" CommandName="del" CssClass="btn btn-warning btn-xs" ><i class="fa fa-remove"></i>&nbsp;&nbsp;  删除</asp:LinkButton> 
                                        </td>-->
                                    </tr>
                                </ItemTemplate>
                                <FooterTemplate>
                                    </tbody>                           
                                </table>
                                </FooterTemplate>
                            </asp:Repeater>
                            <webdiyer:AspNetPager ID="AspNetPager1" runat="server" PageSize="20" FirstPageText="首页" LastPageText="末页" NextPageText="下一页" PrevPageText="上一页" AlwaysShow="true" OnPageChanging="AspNetPager1_PageChanging" CssClass="paginator" CurrentPageButtonClass="cpb">
                            </webdiyer:AspNetPager>
                            <div class="spClear"></div>
                            <div style="line-height: 30px; height: 30px;">
                                <div id="Pagination" class="right flickr"></div>
                                <div class="left">
                                    <span class="btn_all btn btn-primary  btn-xs" id="btn1">全 选</span>
                                    <span class="btn_all btn btn-primary  btn-xs" id="btn2">取消全选</span>

                                    :&nbsp;:&nbsp;
              <asp:Button ID="Button2" runat="server" class="btn_all btn btn-primary  btn-xs" value="导出" OnClientClick="checkall()" Text="导出选中物流Excel" OnClick="btnExcel_Click" CommandArgument="post" />
                                    <asp:Button ID="Button3" runat="server" class="btn_all btn btn-primary  btn-xs" value="导出" OnClientClick="checkall()" OnClick="btnExcel_Click" Text="导出选中货单Excel" CommandArgument="goods" />
                                    <asp:HiddenField ID="HiddenField1" runat="server" />

                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <!-- 全局js -->
    <script src="../js/jquery.min.js?v=2.1.4"></script>
    <script src="../js/bootstrap.min.js?v=3.3.6"></script>

    <!-- 自定js -->

    <script src="../js/plugins/footable/footable.all.min.js" type="text/javascript"></script>
    <script src="../js/content.js" type="text/javascript"></script>
    <script type="text/javascript" src="../js/layer/layer.js"></script>
    <script src="../../js/jquery.jqprint-0.3.js"></script>
    <%--<script src="../../js/jQuery.print.js"></script>--%>
    <%--<script src="../../js/jquery.printarea.js"></script>--%>
    <script type="text/javascript">
        $(document).ready(function () { $(".footable").footable(); });
    </script>


    <!-- iCheck -->
    <script src="../js/plugins/iCheck/icheck.min.js"></script>
    <script>
        $(document).ready(function () {
            $('.i-checks').iCheck({
                checkboxClass: 'icheckbox_square-green'

            });
        });
    </script>

    <script type="text/javascript">
        $(function () {
            $("#Add").click(function () {
                layer.open({
                    type: 2,
                    title: '添加商品标签',
                    shadeClose: true,
                    shade: 0.8,
                    area: ['90%', '90%'],
                    content: 'UpImgDemo.aspx',  //iframe的url
                    end: function () {
                        location.reload();
                    }
                });

            });

        });

        function viewOrder(ID) {
            layer.open({
                type: 2,
                title: '订单详情页',
                shadeClose: true,
                shade: 0.8,
                area: ['90%', '90%'],
                content: './DDdtail.aspx?id=' + ID,  //iframe的url
            });
        }

        function SendGood(ID) {
            layer.open({
                type: 2,
                title: '',
                shadeClose: true,
                shade: 0.8,
                area: ['90%', '90%'],
                content: './DDSendGoods.aspx?id=' + ID,  //iframe的url
                end: function () {

                    location.reload();

                }
            });
        }

        $('.btn-warning').click(function () {
            return confirm("删除后不可恢复，确定要删除吗？");
        });

        function checkall() {
            var allid = "";
            $(".i-checks div.checked").each(function () {
                allid += $(this).next("label").html() + "-";
            });
            $("#HiddenField1").val(allid);

        }


        $(function () {
            $(".footable tr:nth-child(odd)").addClass("tr_bg"); //隔行变色
            $(".footable tr").hover(
                function () {
                    $(this).addClass("tr_hover_col");
                },
                function () {
                    $(this).removeClass("tr_hover_col");
                }
            );


            //全选
            $("#btn1").click(function () {
                $(".i-checks input:checkbox").attr("checked", true);
                $(".icheckbox_square-green").addClass("checked");
            });




            //取消
            $("#btn2").click(function () {
                $(".i-checks input:checkbox").attr("checked", false);

                $(".icheckbox_square-green").removeClass("checked");
            });
            //复制
            $("#btn3").click(function () {
                var allid = "";
                $(".i-checks div:checked").each(function () {
                    allid += $(this).next("label").html() + "-";
                });
                alert(allid);

            });
            //移动
            //移动
            $("#btn4").click(function () {
                var allid = "";
                $(".i-checks div.checked").each(function () {
                    allid += $(this).next("label").html() + "-";
                });
                alert(allid);
            });


        });
        function PrintMD(_CID) {
            var data = new FormData();
            data.append('OrderID', _CID);//二维码地址
            layer.open({
                type: 3,
                content: '图片生成中。。。',
                //style: 'border:none; background-color:#F7CB52; color:#fff;width:280px;height:230;',
            });
            $.ajax({
                url: "/4g/AJAX/PrintOrderMD.ashx",
                type: 'post',
                data: data,
                dataType: 'JSON',
                processData: false,
                contentType: false,
                success: function (json) {
                    var _content = '<div id="ewmimage' + json.id + '" class="ewmimage" style="text-align:center;height:390px; width:228px" onclick="PrintEvm(' + json.id + ')"><img src=\'' + json.data + '\' id="img' + json.id + '/></div>';
                    console.log(json);
                    if (json.status == 2) {
                        _content = json.data;
                    }
                    layer.closeAll();
                    layer.open({
                        type: 1,
                        title: false, //不显示标题
                        content: _content,
                        shadeClose: true,
                        closeBtn: 0,
                        end: function () {
                            //  layer.closeAll();
                            //  window.location.href = location.href;
                        }
                    });
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    layer.open({
                        content: '<br>生成失败！',
                        //style: 'border:none; background-color:#F7CB52; color:#fff;230px;',
                        time: 2,
                        end: function () {
                            layer.closeAll();
                        }
                    });
                }
            });
        }
        //function doPrint() {
        //    bdhtml = window.document.body.innerHTML;
        //    sprnstr = "<ccc>"; //开始打印标识字符串有17个字符
        //    eprnstr = "<ccc>"; //结束打印标识字符串
        //    prnhtml = bdhtml.substr(bdhtml.indexOf(sprnstr) + 5); //从开始打印标识之后的内容
        //    prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr)); //截取开始标识和结束标识之间的内容
        //    window.document.body.innerHTML = prnhtml; //把需要打印的指定内容赋给body.innerHTML
        //    window.print(); //调用浏览器的打印功能打印指定区域
        //    window.document.body.innerHTML = bdhtml; // 最后还原页面
        //}
        function PrintEvm(id) {
            //$("#ewmimage" + id).printArea();
            //$.print("#ewmimage" + id);
            $("#ewmimage" + id).jqprint({
                debug: false, //如果是true则可以显示iframe查看效果（iframe默认高和宽都很小，可以再源码中调大），默认是false
                importCSS: true, //true表示引进原来的页面的css，默认是true。（如果是true，先会找$("link[media=print]")，若没有会去找$("link")中的css文件）
                printContainer: false, //表示如果原来选择的对象必须被纳入打印（注意：设置为false可能会打破你的CSS规则）。
                operaSupport: false//表示如果插件也必须支持歌opera浏览器，在这种情况下，它提供了建立一个临时的打印选项卡。默认是true
            });
 
        }
    </script>
</body>
</html>
